package com.lsh.task;

import com.lsh.service.PraiseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 点赞模块定时器
 * @author Administrator
 * @date 2019/10/01 18:08
 */

@Component
@Configuration //声明该类为一个配置项
@EnableScheduling //开启对计划任务的支持
public class PraiseDataSaveJob {

    @Resource
    RedisTemplate<String, Object> redisTemplate;

    @Autowired
    PraiseService praiseService;

    @Scheduled(cron = "0/60 * * * * *")
    public void savePraiseDataDB(){
        System.out.println("开始将reids数据保存至数据库,请稍等...");
        praiseService.praiseDataFToDB();

    }


}
